#include "stdafx.h"
#include <stdlib.h>
#include "Random.h"
#include "Utilities.h"

namespace Random
{
	float Rand()
	{
		return toFloat(rand()) / toFloat(RAND_MAX);
	}

	float Rand(const float &aMin, const float &aMax)
	{
		return aMin+Rand()*(aMax-aMin);
	}

	Vector2f Rand(const Vector2f &aMin, const Vector2f &aMax)
	{
		return Vector2f(aMin.x+Rand()*(aMax.x-aMin.x), aMin.y+Rand()*(aMax.y-aMin.y));
	}

	Vector3f Rand(const Vector3f &aMin, const Vector3f &aMax)
	{
		return Vector3f(aMin.x+Rand()*(aMax.x-aMin.x), aMin.y+Rand()*(aMax.y-aMin.y), aMin.z+Rand()*(aMax.z-aMin.z));
	}

	Vector4f Rand(const Vector4f &aMin, const Vector4f &aMax)
	{
		return Vector4f(aMin.x+Rand()*(aMax.x-aMin.x),
			aMin.y+Rand()*(aMax.y-aMin.y),
			aMin.z+Rand()*(aMax.z-aMin.z),
			aMin.w+Rand()*(aMax.w-aMin.w));
	}
};